package FileAndRecurison.递归;

/*
递归计算1-n之和
*/
public class RecurisonTest02 {
    public static void main(String[] args) {
        int sum = sum(100);
        System.out.println(sum);
    }

    private static int sum(int i) {
        if (i == 1) {
            return 1;
        }
        return  sum(i-1)+i;
    }
}
